

#ifndef Common_h
#define Common_h


#import "Singleton.h"

//防止字符串为空时崩溃
#define kStringFrom(s) [NSString stringWithFormat:@"%@",(s)]

//字符串UTF8编码
#define LT_UTF8Encode(str) [str dataUsingEncoding:NSUTF8StringEncoding]

//UserDefaults
#define LT_UserDefaults [NSUserDefaults standardUserDefaults]

//沙盒路径
#define kDocPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject]

//block弱强引用
#define WEAKSELF typeof(self) __weak weakSelf = self;
#define LTSTRONGSELF __strong typeof(weakSelf) strongSelf = weakSelf;


//关键字
#define kCurrentAccount @"CURRENTACCOUNT"
#define kCurrentLoginState @"CURRENTLOGINSTATE"

//根据名称获取图片
#define IMG_Name(imgName)        [UIImage imageNamed:(imgName)]

//如果release状态就不执行NSLog函数
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"\n %s:%d   %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],__LINE__, [[[NSString alloc] initWithData:[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] dataUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding] UTF8String]);
#else
#define NSLog(...)
#endif

#endif /* Common_h */
